//
//  EncodeTestClass.m
//  EncodeTest
//
//  Created by terry franguiadakis on 4/25/09.
//  Copyright 2009 __MyCompanyName__. All rights reserved.
//

#import "EncodeTestClass.h"


@implementation EncodeTestClass

-(id)init
{
    m_name = [[NSString stringWithString:@"nil"] retain];
    m_geomName = [[NSString stringWithString:@"quad"] retain];
    m_transform.pos[0] = 0.0f;
    m_transform.pos[1] = 0.0f;
    m_transform.rot = 0.0f;
    m_transform.scale[0] = 1.0f;
    m_transform.scale[1] = 1.0f;
}

-(id)initWithCoder:(NSCoder*)coder
{
   // [super initWithCoder:coder];
    m_name = [coder decodeObjectForKey:@"ModelName"];
    m_geomName = [coder decodeObjectForKey:@"GeomName"];
    m_transform.pos[0] = [coder decodeFloatForKey:@"posx"];
    m_transform.pos[1] = [coder decodeFloatForKey:@"posy"];
    m_transform.rot = [coder decodeFloatForKey:@"rot"];
    m_transform.scale[0] = [coder decodeFloatForKey:@"scalex"];
    m_transform.scale[1] = [coder decodeFloatForKey:@"scaley"];
    return self;
}

- (void)encodeWithCoder:(NSCoder*)coder
{
    [coder encodeObject:m_name forKey:@"ModelName"];
    [coder encodeObject:m_geomName forKey:@"GeomName"];
    [coder encodeFloat:m_transform.pos[0] forKey:@"posx"];
    [coder encodeFloat:m_transform.pos[1] forKey:@"posy"];
    [coder encodeFloat:m_transform.rot forKey:@"rot"];
    [coder encodeFloat:m_transform.scale[0] forKey:@"scalex"];
    [coder encodeFloat:m_transform.scale[1] forKey:@"scaley"];
}

@end
